<script setup>
import {ref,reactive,onBeforeMount} from 'vue'
import getCommentById from "../api/getCommentById.js"
import getUserById from '../api/getUserById.js';
const props =  defineProps({
    id:String
})
const comment = ref({})
const user = ref({})
onBeforeMount(()=>{
    if(props.id != null)
    {
        getCommentById(props.id).then((res)=>{
            if(res.status == 200)
            {
                comment.value = res.data 
                console.log(res.data)
                getUserById(comment.value.userId).then((res)=>{
                if(res.status == 200)
                    {
                        user.value = res.data
                    }
                })
            }
        })
    }
})

</script>

<template>
    <span> {{  user.userName }}</span>
</template>

<style>
</style>